package org.abettor.jroa;

import java.io.Closeable;
import java.io.IOException;

/**
 * <p>This interface describes a object which is listening on a specific address
 * and preparing to accept any connection.</p>
 * 
 * @author <a href="http://www.abettor.org/" target="_blank">abettor</a>
 *
 */
public interface Acceptor extends Closeable
{
	/**
	 * Check if the connection is available.
	 * @return
	 * <p>True if it's available. Otherwise false.</p>
	 */
	public boolean isClosed();

	/**
	 * When someone connect to this object, it can return an <i>Connection</i>
	 * object by calling this function.
	 * @return A object that is connected with peer.
	 * @throws AuthenticationException
	 * @throws IOException
	 */
	public Connection accept() throws IOException, AuthenticationException;
}
